package stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class ToArray {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        Object[] objects1 = list.stream().toArray();
//        for (int i = 0; i < objects1.length; i++) {
//            System.out.println(objects1[i].toString());
//        }
        Arrays.stream(objects1).forEach(System.out::println);
    }
}
